﻿//using Acme.BookStore.Authors;
using Acme.BookStore.Ball;
using Acme.BookStore.BallDto;
using Acme.BookStore.Car;
using Acme.BookStore.Domain.Entities;
using Acme.BookStore.FormWhx.Binlocation;
using Acme.BookStore.FormWhx.Ruku;
using Acme.BookStore.FormWhx.Storehouse;
using Acme.BookStore.FormWhxDto.BinlocationDto;
using Acme.BookStore.FormWhxDto.RukuDto;
using Acme.BookStore.FormWhxDto.StorehouseDto;
using Acme.BookStore.Gongyings;
//using Acme.BookStore.Purchase.Dtos;
//using Acme.BookStore.StockManagement.Dtos;
using Acme.BookStore.Gongyings.Dtos;
using Acme.BookStore.Kehus;
using Acme.BookStore.Kehus.Dtos;
//using Acme.BookStore.Car.Dtos;
//using Acme.BookStore.Elp.Dtos;
using Acme.BookStore.Products;
using Acme.BookStore.Products.Dtos;
using Acme.BookStore.Purchase;
using Acme.BookStore.Purchase.Customergoods;
using Acme.BookStore.Purchase.NotificationOrder;
using Acme.BookStore.Purchase.Otherwarehousing;
using Acme.BookStore.Purchase.ReceiptOrder;
using Acme.BookStore.PurchaseDto.CustomergoodsDto;
using Acme.BookStore.PurchaseDto.Goods;
using Acme.BookStore.PurchaseDto.NotificationOrder;
using Acme.BookStore.PurchaseDto.OtherwarehousingDto;
using Acme.BookStore.PurchaseDto.ReceiptOrderDto;
using Acme.BookStore.Rfids;
using Acme.BookStore.Rfids.Dtos;
using Acme.BookStore.Shops.Dtos;
using AutoMapper;
using AutoMapper;
using static Acme.BookStore.Permissions.BookStorePermissions;
using Vehicle = Acme.BookStore.Car.Vehicle;

namespace Acme.BookStore;

public class BookStoreApplicationAutoMapperProfile : Profile
{
    public BookStoreApplicationAutoMapperProfile()
    {
        CreateMap<Kehu, KehuDto>();
        CreateMap<BallModel, BallDto.BallDto>().ReverseMap();
        CreateMap<CreateUpdateBallDto, BallModel>().ReverseMap();
        CreateMap<CustomergoodsModel, CreateUpdateCustomergoodsDto>().ReverseMap();
        CreateMap<CustomergoodsDto, CustomergoodsModel>().ReverseMap();

        CreateMap<Book, BookDto>();
        CreateMap<CreateUpdateBookDto, Book>();

        //CreateMap<Author, AuthorDto>();

        //CreateMap<Author, AuthorLookupDto>();

        CreateMap<GoodsModel, GoodsDto>();
        /* You can configure your AutoMapper mapping configuration here.
         * Alternatively, you can split your mapping configurations
         * into multiple profile classes for a better organization. */
        CreateMap<Car.Vehicle, VehicleDto>().ReverseMap();
        CreateMap<CreateUpdateVehicleDto, Car.Vehicle>().ReverseMap();

        CreateMap<ADManagement, ADManagementDto>();
        CreateMap<CreateUpdateADManagementDto, ADManagement>();

        CreateMap<Kehu, KehuDto>();

        CreateMap<Orders, OrdersDto>();
        CreateMap<CreateUpdateOrdersDto, Orders>();

        CreateMap<CreateUpdateFleetcarDto, CarFleetsc>();
        CreateMap<CarFleetsc, FleetcarDto>();

        CreateMap<Car.Vehicle, VehicleLookupDto>();

        // 添加仓库相关的映射配置
        CreateMap<SorehouseModels, StorehouseDto>();
        CreateMap<CreateUpdateStorehouseDto, SorehouseModels>();
        CreateMap<FormWhxDto.StorehouseDto.CreateUpdateStorehouseWithLocationsDto, SorehouseModels>()
            .ForMember(dest => dest.Id, opt => opt.Ignore())
            .IncludeMembers(src => src.Storehouse);
        
        // 添加库位相关的映射配置
        CreateMap<locationModel, locationModelDto>();
        CreateMap<CreateUpdatelocationModelDto, locationModel>();
        
        // 添加库管部门的映射配置
        CreateMap<ManagementDeptModel, ManagementDeptDto>();
        
        // 添加仓库主管的映射配置
        CreateMap<WarehouseManagerModel, WarehouseManagerDto>();
        //其它入库
        CreateMap<OtherwarehousingModel, OtherwarehousingDto>();
        CreateMap<CreateUpdateOtherwarehousingDto, OtherwarehousingModel>();

        //CreateMap<SorehouseModel, StorehouseDto>();
        //CreateMap<CreateUpdateStorehouseDto, SorehouseModel>();

        CreateMap<InventryTran, InventoryTransferDto>();
        CreateMap < CreateUpdateInventoryTransferDto, InventryTran>();

        CreateMap<Purchase.NotificationOrder.NotificationOrders, NotificationOrderDto>();

        //zmy
        CreateMap<SorehouseModels, WarehouseNameDtozmy>();

        CreateMap<ReceiptOrders, PurchaseDto.ReceiptOrderDto.ReceiptOrderDto>();
        CreateMap<CreateUpdateReceiptOrderDto, ReceiptOrders>();

        CreateMap<CreateUpdateReceiptOrderDto, ReceiptOrders>();
        CreateMap<CarInventryss, CarInventryDto>();
        CreateMap<CreateUpdateCarInventryDto, CarInventryss>();
        CreateMap<Vehicle, VehicleLookupDto>();

        CreateMap<CreateKehuDto, Kehu>();
        
        //CreateMap<VehicleEntity, VehicleDto>();
        //CreateMap<CreateUpdateVehicleDto, VehicleEntity>();
         
        //配送人员表
        //CreateMap<ELP, ELPDto>();
        
        // 商品管理映射
        CreateMap<ShopWhere, ShopWhereDto>();
        CreateMap<CreateShopWhereDto, ShopWhere>();
         
        // 库存管理映射
        //CreateMap<Stock, StockDto>();
         
        // 采购管理映射
        //CreateMap<PurchaseGoods, PurchaseGoodsDto>();
        //CreateMap<CreateUpdatePurchaseGoodsDto, PurchaseGoods>();

        // 供应商映射
        CreateMap<Gongying, GongyingDto>();
        CreateMap<CreateGongyingDto, Gongying>();
        
        // Shop实体映射
        CreateMap<Shop, ShopDto>();
        CreateMap<CreateShopDto, Shop>();

        CreateMap<Rfid, RfidDto>();
        CreateMap<CreateUpdateReceiptOrderDto, ReceiptOrders>();
        CreateMap<CarInventryss, CarInventryDto>();
        CreateMap<CreateUpdateCarInventryDto, CarInventryss>();

        CreateMap<Merchandise, MerchandiseDto>().ReverseMap();
        CreateMap<CreateUpdateMerchandiseDto, Merchandise>();

        CreateMap<locationModel, locationModelDto>();
        CreateMap<CreateUpdatelocationModelDto, locationModel>();

        // 添加 Goods 的完整映射
        CreateMap<Goods, GoodsDtozmyy>();
        CreateMap<CreateUpdateMerchandiseDto, Merchandise>();

        CreateMap<OrderOutStock, OutStockOrderDto>();
        CreateMap<CreateUpdateOutStockOrderDto, OrderOutStock>();

        CreateMap<OrderOutDetail, OutStockOrderDetailDto>();
        CreateMap<CreateUpdateOutStockOrderDetailDto, OrderOutDetail>();

        CreateMap<WarehouseOperationLog, WarehouseOperationLogDto>();

        // 入库主表映射
        CreateMap<RuKuModel, RuKuModelDto>().ReverseMap();
        CreateMap<CreateUpdateRuKuDto, RuKuModel>().ReverseMap();
        // 入库明细映射
        CreateMap<RuKuDetailModel, CreateUpdateRuKuDetailsDto>().ReverseMap();
        CreateMap<RuKuDetailModel, RuKuDetailModelDto>().ReverseMap();
        // 入库货品明细映射
        CreateMap<ItemsModel, ItemsModelDto>().ReverseMap();
        // 关联单号映射
        CreateMap<ConnectFromModel, ConnectFromModelDto>().ReverseMap();
        CreateMap<RuKuModel, RuKuQueryDto>();
       // CreateMap<RuKuDetailModel, RuKuDetailModelDto>();

    }
}
